define(["jquery", "easy-admin"], function ($, ea) {

    var init = {
        table_elem: '#currentTable',
        table_render_id: 'currentTableRenderId',
        index_url: 'manageuser.user/index',
        add_url: 'manageuser.user/add',
        edit_url: 'manageuser.user/edit',
        delete_url: 'manageuser.user/delete',
        export_url: 'manageuser.user/export',
        modify_url: 'manageuser.user/modify',
        adopt_url: 'manageuser.user/adopt_url',
    };
    var Controller = {
        index: function () {
            ea.table.render({
                init: init,
                toolbar: ['refresh'],
                cols: [[
                    {field: 'avatar', minWidth: 80, title: '头像', search: false, templet: ea.table.image},
                    {field: 'nickname', title: '用户昵称'},
                    {field: 'phone', title: '手机号'},
                    {field: 'gender', title: '性别',selectList: {0:'男',1: '女'}},
                    {field: 'is_mermber', title: '是否会员',selectList: {0:'否',1: '是'}},
                    {field: 'is_check', title: '是否分销商',selectList: {0:'否',1: '是'}},
                    {field: 'dynamic_code', title: '动态码'},
                    {field: 'status', title: '用户状态', templet: ea.table.switch, search: false},
                    {field: 'create_time', title: '注册时间', search: false},
                    {
                        width: 200,
                        title: '操作',
                        templet: function (d) {
                            console.log(d,'d')
                            if (d.is_check == 0) {
                                return '<div class="layui-table-cell laytable-cell-1-0-5">' +
                                    '<a class="layui-btn layui-btn-xs layui-btn-normal" data-request="'+init.adopt_url+'?id='+d.id+'" data-title="确定操作吗？" data-table="currentTableRenderId">设置分销商</a>' +
                                '</div>';
                            } else {
                                return '';
                                
                                
                            }
                        },
                    }




                ]],
            });
            ea.listen();
        },
        add: function () {
            ea.listen();
        },
        edit: function () {
            ea.listen();
        },
        binding_experts: function () {
            ea.listen();
        }
    };
    return Controller;
});